<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>文锦手相馆 - 专业手相分析</title>
    <link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;700&family=Noto+Sans+SC:wght@300;400;500;700&family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <style>
        :root {
            --primary-bg: #0a0a16;
            --secondary-bg: #121225;
            --accent-blue: #00c6ff;
            --accent-purple: #8a2be2;
            --accent-green: #20f7a4;
            --accent-red: #ff4d6d;
            --text-primary: #f0f0f0;
            --text-secondary: #b0b0d0;
            --border-color: #2a2a4a;
            --card-bg: rgba(18, 18, 37, 0.7);
            --glow-blue: 0 0 10px rgba(0, 198, 255, 0.7);
            --glow-purple: 0 0 10px rgba(138, 43, 226, 0.7);
        }
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Noto Sans SC', 'Roboto', sans-serif;
            background: var(--primary-bg);
            color: var(--text-primary);
            line-height: 1.6;
            min-height: 100vh;
            overflow-x: hidden;
            background-image: 
                radial-gradient(circle at 10% 20%, rgba(20, 20, 60, 0.8) 0%, transparent 20%),
                radial-gradient(circle at 90% 80%, rgba(40, 20, 80, 0.6) 0%, transparent 20%);
        }
        
        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 20px;
        }
        
        header {
            padding: 30px 0;
            text-align: center;
            border-bottom: 1px solid var(--border-color);
            margin-bottom: 40px;
            position: relative;
        }
        
        h1 {
            font-family: 'Orbitron', sans-serif;
            font-size: 2.8rem;
            background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
            letter-spacing: 2px;
            text-shadow: 0 0 15px rgba(0, 198, 255, 0.5);
            margin-bottom: 10px;
        }
        
        .tagline {
            color: var(--text-secondary);
            font-size: 1.1rem;
            letter-spacing: 1px;
        }
        
        .main-content {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 40px;
            margin-bottom: 60px;
        }
        
        @media (max-width: 768px) {
            .main-content {
                grid-template-columns: 1fr;
            }
        }
        
        .upload-section, .analysis-section {
            background: var(--card-bg);
            border-radius: 12px;
            padding: 30px;
            border: 1px solid var(--border-color);
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            backdrop-filter: blur(10px);
        }
        
        .section-title {
            font-family: 'Orbitron', sans-serif;
            font-size: 1.5rem;
            margin-bottom: 25px;
            color: var(--accent-blue);
            display: flex;
            align-items: center;
        }
        
        .section-title::before {
            content: "";
            display: inline-block;
            width: 6px;
            height: 25px;
            background: var(--accent-blue);
            margin-right: 10px;
            border-radius: 3px;
        }
        
        .upload-area {
            border: 2px dashed var(--border-color);
            border-radius: 8px;
            padding: 40px 20px;
            text-align: center;
            margin-bottom: 30px;
            transition: all 0.3s ease;
            cursor: pointer;
            position: relative;
            min-height: 200px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
        }
        
        .upload-area:hover {
            border-color: var(--accent-blue);
            box-shadow: var(--glow-blue);
        }
        
        .upload-area.dragover {
            background: rgba(0, 198, 255, 0.1);
        }
        
        .upload-icon {
            font-size: 3rem;
            margin-bottom: 15px;
            color: var(--accent-blue);
        }
        
        .upload-text {
            font-size: 1.2rem;
            margin-bottom: 10px;
        }
        
        .upload-hint {
            color: var(--text-secondary);
            font-size: 0.9rem;
            margin-bottom: 15px;
        }
        
        .file-input {
            display: none;
        }
        
        .file-info {
            margin-top: 15px;
            font-size: 0.9rem;
            color: var(--accent-green);
        }
        
        .preview-container {
            margin-top: 20px;
            display: none;
        }
        
        .preview-image {
            max-width: 100%;
            max-height: 200px;
            border-radius: 8px;
            border: 1px solid var(--border-color);
        }
        
        .hand-selection {
            display: flex;
            gap: 15px;
            margin-bottom: 25px;
        }
        
        .hand-btn {
            flex: 1;
            padding: 12px;
            background: var(--secondary-bg);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            color: var(--text-primary);
            font-family: 'Noto Sans SC', sans-serif;
            font-size: 1rem;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }
        
        .hand-btn.active {
            background: rgba(0, 198, 255, 0.1);
            border-color: var(--accent-blue);
            box-shadow: var(--glow-blue);
        }
        
        .hand-btn:hover:not(.active) {
            border-color: var(--accent-purple);
        }
        
        .analyze-btn {
            width: 100%;
            padding: 15px;
            background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
            border: none;
            border-radius: 8px;
            color: white;
            font-family: 'Orbitron', sans-serif;
            font-size: 1.1rem;
            letter-spacing: 1px;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }
        
        .analyze-btn::before {
            content: "";
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
            transition: all 0.6s;
        }
        
        .analyze-btn:hover::before {
            left: 100%;
        }
        
        .analyze-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(0, 198, 255, 0.4);
        }
        
        .analyze-btn:disabled {
            opacity: 0.6;
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }
        
        .energy-field {
            height: 200px;
            background: radial-gradient(circle, rgba(0, 198, 255, 0.1) 0%, transparent 70%);
            border-radius: 8px;
            margin-bottom: 30px;
            position: relative;
            overflow: hidden;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .palm-outline {
            width: 150px;
            height: 180px;
            position: relative;
        }
        
        .palm {
            width: 100%;
            height: 100%;
            fill: none;
            stroke: var(--accent-blue);
            stroke-width: 2;
            opacity: 0.7;
        }
        
        .energy-flow {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
        }
        
        .flow-line {
            position: absolute;
            background: var(--accent-blue);
            height: 2px;
            width: 100px;
            opacity: 0.7;
            animation: flow 3s linear infinite;
        }
        
        .flow-line:nth-child(1) {
            top: 20%;
            left: -100px;
            animation-delay: 0s;
        }
        
        .flow-line:nth-child(2) {
            top: 40%;
            left: -100px;
            animation-delay: 0.5s;
        }
        
        .flow-line:nth-child(3) {
            top: 60%;
            left: -100px;
            animation-delay: 1s;
        }
        
        .flow-line:nth-child(4) {
            top: 80%;
            left: -100px;
            animation-delay: 1.5s;
        }
        
        @keyframes flow {
            0% {
                transform: translateX(0);
                opacity: 0;
            }
            10% {
                opacity: 1;
            }
            90% {
                opacity: 1;
            }
            100% {
                transform: translateX(300px);
                opacity: 0;
            }
        }
        
        .analysis-result {
            display: none;
        }
        
        .palm-line-analysis {
            margin-bottom: 30px;
        }
        
        .line-item {
            margin-bottom: 25px;
            padding-bottom: 20px;
            border-bottom: 1px solid var(--border-color);
        }
        
        .line-title {
            display: flex;
            align-items: center;
            margin-bottom: 15px;
            font-family: 'Orbitron', sans-serif;
            color: var(--accent-green);
        }
        
        .line-icon {
            width: 24px;
            height: 24px;
            background: var(--accent-green);
            border-radius: 50%;
            margin-right: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            color: var(--primary-bg);
        }
        
        .line-visual {
            display: flex;
            gap: 20px;
            margin-bottom: 15px;
            align-items: center;
        }
        
        .line-diagram {
            width: 120px;
            height: 120px;
            position: relative;
            flex-shrink: 0;
        }
        
        .palm-mini {
            width: 100%;
            height: 100%;
            fill: none;
            stroke: var(--text-secondary);
            stroke-width: 1;
            opacity: 0.5;
        }
        
        .line-highlight {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
        }
        
        .highlight-line {
            stroke: var(--accent-green);
            stroke-width: 3;
            filter: drop-shadow(0 0 5px var(--accent-green));
        }
        
        .line-description {
            flex: 1;
        }
        
        .metric-item {
            margin-bottom: 20px;
        }
        
        .metric-label {
            display: flex;
            justify-content: space-between;
            margin-bottom: 8px;
            font-size: 0.9rem;
        }
        
        .metric-bar {
            height: 8px;
            background: var(--secondary-bg);
            border-radius: 4px;
            overflow: hidden;
        }
        
        .metric-fill {
            height: 100%;
            background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
            border-radius: 4px;
            width: 0;
            transition: width 1.5s ease;
        }
        
        .warning-note {
            background: rgba(255, 100, 100, 0.1);
            border-left: 4px solid var(--accent-red);
            padding: 15px;
            margin: 20px 0;
            border-radius: 0 8px 8px 0;
        }
        
        .positive-note {
            background: rgba(32, 247, 164, 0.1);
            border-left: 4px solid var(--accent-green);
            padding: 15px;
            margin: 20px 0;
            border-radius: 0 8px 8px 0;
        }
        
        .analysis-chart {
            margin: 30px 0;
            background: var(--secondary-bg);
            border-radius: 8px;
            padding: 20px;
        }
        
        .chart-container {
            height: 300px;
            position: relative;
        }
        
        .analysis-details {
            margin-top: 30px;
        }
        
        .detail-item {
            margin-bottom: 20px;
            padding: 15px;
            background: rgba(255, 255, 255, 0.05);
            border-radius: 8px;
        }
        
        .detail-title {
            font-family: 'Orbitron', sans-serif;
            color: var(--accent-blue);
            margin-bottom: 10px;
            display: flex;
            align-items: center;
        }
        
        .detail-title::before {
            content: "▶";
            margin-right: 10px;
            font-size: 0.8rem;
            color: var(--accent-purple);
        }
        
        footer {
            text-align: center;
            padding: 30px 0;
            color: var(--text-secondary);
            font-size: 0.9rem;
            border-top: 1px solid var(--border-color);
        }
        
        .disclaimer {
            max-width: 800px;
            margin: 0 auto 20px;
            font-size: 0.8rem;
            opacity: 0.7;
        }
        
        .loading {
            display: none;
            text-align: center;
            padding: 20px;
        }
        
        .loading-spinner {
            width: 40px;
            height: 40px;
            border: 4px solid rgba(0, 198, 255, 0.3);
            border-left: 4px solid var(--accent-blue);
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin: 0 auto 15px;
        }
        
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        
        .analysis-progress {
            margin-top: 20px;
        }
        
        .progress-bar {
            height: 6px;
            background: var(--secondary-bg);
            border-radius: 3px;
            overflow: hidden;
            margin-bottom: 10px;
        }
        
        .progress-fill {
            height: 100%;
            background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
            width: 0%;
            transition: width 0.3s ease;
        }
        
        .progress-text {
            font-size: 0.9rem;
            color: var(--text-secondary);
            text-align: center;
        }
        
        .result-summary {
            background: rgba(0, 198, 255, 0.1);
            border-radius: 8px;
            padding: 20px;
            margin-bottom: 30px;
            border-left: 4px solid var(--accent-blue);
        }
        
        .summary-title {
            font-family: 'Orbitron', sans-serif;
            color: var(--accent-blue);
            margin-bottom: 10px;
        }
    </style>
</head>
<body>
    <div class="container">
        <header>
            <h1>文锦手相馆</h1>
            <p class="tagline">基于深度AI算法的专业手相分析与诊断</p>
        </header>
        
        <main class="main-content">
            <section class="upload-section">
                <h2 class="section-title">看看你的手相</h2>
                
                <div class="upload-area" id="uploadArea">
                    <div class="upload-icon">✋</div>
                    <p class="upload-text">上传手掌照片进行深度分析</p>
                    <p class="upload-hint">支持 JPG、PNG 格式，建议在光线充足环境下拍摄</p>
                    <button class="analyze-btn" style="width: auto; padding: 10px 20px; margin-top: 10px;">选择文件</button>
                    <input type="file" id="fileInput" class="file-input" accept="image/*">
                </div>
                
                <div class="preview-container" id="previewContainer">
                    <img id="previewImage" class="preview-image" src="" alt="手掌预览">
                    <p class="file-info" id="fileInfo"></p>
                </div>
                
                <div class="hand-selection">
                    <button class="hand-btn active" data-hand="left">
                        <span>左手</span>
                    </button>
                    <button class="hand-btn" data-hand="right">
                        <span>右手</span>
                    </button>
                </div>
                
                <button class="analyze-btn" id="analyzeBtn" disabled>启动深度分析</button>
                
                <div class="loading" id="loading">
                    <div class="loading-spinner"></div>
                    <p>正在分析您的手相，请稍候...</p>
                    <div class="analysis-progress">
                        <div class="progress-bar">
                            <div class="progress-fill" id="progressFill"></div>
                        </div>
                        <div class="progress-text" id="progressText">分析准备中...</div>
                    </div>
                </div>
            </section>
            
            <section class="analysis-section">
                <h2 class="section-title">手相分析报告</h2>
                
                <div class="energy-field">
                    <div class="palm-outline">
                        <svg class="palm" viewBox="0 0 100 120">
                            <path d="M50,10 C60,5 75,10 80,25 C85,40 80,60 70,75 C65,85 55,95 50,100 C45,95 35,85 30,75 C20,60 15,40 20,25 C25,10 40,5 50,10 Z" />
                            <path d="M40,20 L40,5" />
                            <path d="M50,15 L50,0" />
                            <path d="M60,20 L60,5" />
                        </svg>
                        <div class="energy-flow">
                            <div class="flow-line"></div>
                            <div class="flow-line"></div>
                            <div class="flow-line"></div>
                            <div class="flow-line"></div>
                        </div>
                    </div>
                </div>
                
                <div class="analysis-result" id="analysisResult">
                    <!-- 分析结果将通过JavaScript动态生成 -->
                </div>
            </section>
        </main>
        
        <footer>
            <p class="disclaimer">本手相分析基于传统手相学结合现代数据分析技术，结果仅供参考，不应作为人生决策的唯一依据。文锦手相馆保留所有解释权。</p>
            <p>© 2023 文锦手相馆 · 探索掌中宇宙的奥秘</p>
        </footer>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // 获取DOM元素
            const uploadArea = document.getElementById('uploadArea');
            const fileInput = document.getElementById('fileInput');
            const previewContainer = document.getElementById('previewContainer');
            const previewImage = document.getElementById('previewImage');
            const fileInfo = document.getElementById('fileInfo');
            const handBtns = document.querySelectorAll('.hand-btn');
            const analyzeBtn = document.getElementById('analyzeBtn');
            const loading = document.getElementById('loading');
            const progressFill = document.getElementById('progressFill');
            const progressText = document.getElementById('progressText');
            const analysisResult = document.getElementById('analysisResult');
            
            let selectedHand = 'left';
            let currentFile = null;
            
            // 文件上传处理
            uploadArea.addEventListener('click', function() {
                fileInput.click();
            });
            
            fileInput.addEventListener('change', function(e) {
                if (e.target.files.length > 0) {
                    currentFile = e.target.files[0];
                    displayFileInfo(currentFile);
                    analyzeBtn.disabled = false;
                }
            });
            
            // 拖放功能
            uploadArea.addEventListener('dragover', function(e) {
                e.preventDefault();
                uploadArea.classList.add('dragover');
            });
            
            uploadArea.addEventListener('dragleave', function() {
                uploadArea.classList.remove('dragover');
            });
            
            uploadArea.addEventListener('drop', function(e) {
                e.preventDefault();
                uploadArea.classList.remove('dragover');
                
                if (e.dataTransfer.files.length > 0) {
                    currentFile = e.dataTransfer.files[0];
                    displayFileInfo(currentFile);
                    analyzeBtn.disabled = false;
                }
            });
            
            function displayFileInfo(file) {
                const fileName = file.name;
                const fileSize = (file.size / 1024 / 1024).toFixed(2); // MB
                
                fileInfo.textContent = `文件名: ${fileName} (${fileSize} MB)`;
                
                const reader = new FileReader();
                reader.onload = function(e) {
                    previewImage.src = e.target.result;
                    previewContainer.style.display = 'block';
                };
                reader.readAsDataURL(file);
            }
            
            // 左右手选择
            handBtns.forEach(btn => {
                btn.addEventListener('click', function() {
                    handBtns.forEach(b => b.classList.remove('active'));
                    this.classList.add('active');
                    selectedHand = this.getAttribute('data-hand');
                });
            });
            
            // 分析按钮点击事件
            analyzeBtn.addEventListener('click', function() {
                if (!currentFile) return;
                
                // 显示加载状态
                loading.style.display = 'block';
                analyzeBtn.disabled = true;
                
                // 模拟分析进度
                simulateAnalysisProgress();
            });
            
            // 模拟分析进度
            function simulateAnalysisProgress() {
                let progress = 0;
                const progressInterval = setInterval(() => {
                    progress += Math.random() * 10;
                    if (progress >= 100) {
                        progress = 100;
                        clearInterval(progressInterval);
                        
                        // 分析完成
                        setTimeout(() => {
                            loading.style.display = 'none';
                            generateAnalysisResult();
                        }, 500);
                    }
                    
                    progressFill.style.width = progress + '%';
                    
                    // 更新进度文本
                    if (progress < 30) {
                        progressText.textContent = '正在扫描掌纹特征...';
                    } else if (progress < 60) {
                        progressText.textContent = '分析生命线与健康指数...';
                    } else if (progress < 80) {
                        progressText.textContent = '解析智慧线与情感线...';
                    } else {
                        progressText.textContent = '生成最终分析报告...';
                    }
                }, 300);
            }
            
            // 生成分析结果
            function generateAnalysisResult() {
                // 清空之前的结果
                analysisResult.innerHTML = '';
                
                // 生成随机但基于手相学的分析结果
                const analysisData = generatePalmAnalysis();
                
                // 创建分析结果HTML
                let resultHTML = `
                    <div class="result-summary">
                        <h3 class="summary-title">分析摘要</h3>
                        <p>根据您${selectedHand === 'left' ? '左手' : '右手'}的掌纹特征，我们完成了深度分析。您的手相显示出${analysisData.overallTendency}的特征，${analysisData.summary}。</p>
                    </div>
                    
                    <div class="palm-line-analysis">
                        <div class="line-item">
                            <h3 class="line-title">
                                <span class="line-icon">生</span>
                                生命线分析
                            </h3>
                            <div class="line-visual">
                                <div class="line-diagram">
                                    <svg class="palm-mini" viewBox="0 0 100 120">
                                        <path d="M50,10 C60,5 75,10 80,25 C85,40 80,60 70,75 C65,85 55,95 50,100 C45,95 35,85 30,75 C20,60 15,40 20,25 C25,10 40,5 50,10 Z" />
                                    </svg>
                                    <svg class="line-highlight" viewBox="0 0 100 120">
                                        <path class="highlight-line" d="${analysisData.lifeLine.path}" />
                                    </svg>
                                </div>
                                <div class="line-description">
                                    <p>${analysisData.lifeLine.description}</p>
                                    ${analysisData.lifeLine.warning ? `<div class="warning-note"><strong>警示：</strong>${analysisData.lifeLine.warning}</div>` : ''}
                                    ${analysisData.lifeLine.positive ? `<div class="positive-note"><strong>优势：</strong>${analysisData.lifeLine.positive}</div>` : ''}
                                </div>
                            </div>
                        </div>
                        
                        <div class="line-item">
                            <h3 class="line-title">
                                <span class="line-icon">智</span>
                                智慧线分析
                            </h3>
                            <div class="line-visual">
                                <div class="line-diagram">
                                    <svg class="palm-mini" viewBox="0 0 100 120">
                                        <path d="M50,10 C60,5 75,10 80,25 C85,40 80,60 70,75 C65,85 55,95 50,100 C45,95 35,85 30,75 C20,60 15,40 20,25 C25,10 40,5 50,10 Z" />
                                    </svg>
                                    <svg class="line-highlight" viewBox="0 0 100 120">
                                        <path class="highlight-line" d="${analysisData.mindLine.path}" />
                                    </svg>
                                </div>
                                <div class="line-description">
                                    <p>${analysisData.mindLine.description}</p>
                                    ${analysisData.mindLine.warning ? `<div class="warning-note"><strong>警示：</strong>${analysisData.mindLine.warning}</div>` : ''}
                                    ${analysisData.mindLine.positive ? `<div class="positive-note"><strong>优势：</strong>${analysisData.mindLine.positive}</div>` : ''}
                                </div>
                            </div>
                        </div>
                        
                        <div class="line-item">
                            <h3 class="line-title">
                                <span class="line-icon">情</span>
                                感情线分析
                            </h3>
                            <div class="line-visual">
                                <div class="line-diagram">
                                    <svg class="palm-mini" viewBox="0 0 100 120">
                                        <path d="M50,10 C60,5 75,10 80,25 C85,40 80,60 70,75 C65,85 55,95 50,100 C45,95 35,85 30,75 C20,60 15,40 20,25 C25,10 40,5 50,10 Z" />
                                    </svg>
                                    <svg class="line-highlight" viewBox="0 0 100 120">
                                        <path class="highlight-line" d="${analysisData.heartLine.path}" />
                                    </svg>
                                </div>
                                <div class="line-description">
                                    <p>${analysisData.heartLine.description}</p>
                                    ${analysisData.heartLine.warning ? `<div class="warning-note"><strong>警示：</strong>${analysisData.heartLine.warning}</div>` : ''}
                                    ${analysisData.heartLine.positive ? `<div class="positive-note"><strong>优势：</strong>${analysisData.heartLine.positive}</div>` : ''}
                                </div>
                            </div>
                        </div>
                        
                        <div class="line-item">
                            <h3 class="line-title">
                                <span class="line-icon">运</span>
                                命运线分析
                            </h3>
                            <div class="line-visual">
                                <div class="line-diagram">
                                    <svg class="palm-mini" viewBox="0 0 100 120">
                                        <path d="M50,10 C60,5 75,10 80,25 C85,40 80,60 70,75 C65,85 55,95 50,100 C45,95 35,85 30,75 C20,60 15,40 20,25 C25,10 40,5 50,10 Z" />
                                    </svg>
                                    <svg class="line-highlight" viewBox="0 0 100 120">
                                        <path class="highlight-line" d="${analysisData.fateLine.path}" />
                                    </svg>
                                </div>
                                <div class="line-description">
                                    <p>${analysisData.fateLine.description}</p>
                                    ${analysisData.fateLine.warning ? `<div class="warning-note"><strong>警示：</strong>${analysisData.fateLine.warning}</div>` : ''}
                                    ${analysisData.fateLine.positive ? `<div class="positive-note"><strong>优势：</strong>${analysisData.fateLine.positive}</div>` : ''}
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <h3 class="section-title">能量指数评估</h3>
                    
                    <div class="metrics">
                        <div class="metric-item">
                            <div class="metric-label">
                                <span>心智独立指数</span>
                                <span>${analysisData.metrics.mind}%</span>
                            </div>
                            <div class="metric-bar">
                                <div class="metric-fill" data-value="${analysisData.metrics.mind}"></div>
                            </div>
                        </div>
                        
                        <div class="metric-item">
                            <div class="metric-label">
                                <span>情感韧性指数</span>
                                <span>${analysisData.metrics.emotion}%</span>
                            </div>
                            <div class="metric-bar">
                                <div class="metric-fill" data-value="${analysisData.metrics.emotion}"></div>
                            </div>
                        </div>
                        
                        <div class="metric-item">
                            <div class="metric-label">
                                <span>事业潜能指数</span>
                                <span>${analysisData.metrics.career}%</span>
                            </div>
                            <div class="metric-bar">
                                <div class="metric-fill" data-value="${analysisData.metrics.career}"></div>
                            </div>
                        </div>
                        
                        <div class="metric-item">
                            <div class="metric-label">
                                <span>健康预警指数</span>
                                <span>${analysisData.metrics.health}%</span>
                            </div>
                            <div class="metric-bar">
                                <div class="metric-fill" data-value="${analysisData.metrics.health}"></div>
                            </div>
                        </div>
                        
                        <div class="metric-item">
                            <div class="metric-label">
                                <span>人际关系指数</span>
                                <span>${analysisData.metrics.relationship}%</span>
                            </div>
                            <div class="metric-bar">
                                <div class="metric-fill" data-value="${analysisData.metrics.relationship}"></div>
                            </div>
                        </div>
                    </div>
                    
                    <div class="analysis-chart">
                        <h3 class="section-title">掌纹特征雷达图</h3>
                        <div class="chart-container">
                            <canvas id="palmRadarChart"></canvas>
                        </div>
                    </div>
                    
                    <div class="analysis-details">
                        <h3 class="section-title">详细解读</h3>
                        <div class="detail-item">
                            <h4 class="detail-title">整体掌型分析</h4>
                            <p>${analysisData.details.overall}</p>
                        </div>
                        <div class="detail-item">
                            <h4 class="detail-title">特殊标记解读</h4>
                            <p>${analysisData.details.specialMarks}</p>
                        </div>
                        <div class="detail-item">
                            <h4 class="detail-title">未来趋势预测</h4>
                            <p>${analysisData.details.future}</p>
                        </div>
                    </div>
                `;
                
                analysisResult.innerHTML = resultHTML;
                analysisResult.style.display = 'block';
                
                // 触发指标条动画
                setTimeout(() => {
                    animateMetrics();
                    createRadarChart(analysisData.radarData);
                }, 100);
                
                // 重新分析按钮
                const reanalyzeBtn = document.createElement('button');
                reanalyzeBtn.className = 'analyze-btn';
                reanalyzeBtn.textContent = '重新分析';
                reanalyzeBtn.style.marginTop = '30px';
                reanalyzeBtn.addEventListener('click', function() {
                    analysisResult.style.display = 'none';
                    analyzeBtn.disabled = false;
                    // 重置文件选择
                    currentFile = null;
                    fileInput.value = '';
                    previewContainer.style.display = 'none';
                    analyzeBtn.disabled = true;
                });
                
                analysisResult.appendChild(reanalyzeBtn);
                
                // 滚动到分析结果区域
                analysisResult.scrollIntoView({ behavior: 'smooth', block: 'start' });
            }
            
            // 生成手相分析数据
            function generatePalmAnalysis() {
                // 基于文件名和手型生成伪随机但一致的分析结果
                const seed = currentFile ? currentFile.name.length + (selectedHand === 'left' ? 100 : 200) : Math.floor(Math.random() * 1000);
                
                // 简单伪随机数生成器
                let prngSeed = seed;
                function prng() {
                    prngSeed = (prngSeed * 9301 + 49297) % 233280;
                    return prngSeed / 233280;
                }
                
                const lifeLineTypes = [
                    {path: "M30,25 C35,40 40,60 45,75", desc: "长而清晰，显示生命力旺盛，但中段有轻微波动"},
                    {path: "M30,25 C35,45 40,65 45,80", desc: "起始有力但末端分叉，提示早年健康良好但晚年需注意"},
                    {path: "M30,25 C32,35 35,50 40,70", desc: "较短但深刻，显示体质强健但可能有突发健康问题"}
                ];
                
                const mindLineTypes = [
                    {path: "M25,30 C40,25 60,30 70,40", desc: "长而平直，逻辑思维强但创造性稍弱"},
                    {path: "M25,30 C35,20 55,25 75,35", desc: "弯曲明显，直觉和艺术天赋较强"},
                    {path: "M25,30 C30,25 50,28 65,38", desc: "中间有断裂，思维可能经历重大转变"}
                ];
                
                const heartLineTypes = [
                    {path: "M20,20 C30,15 45,15 55,20", desc: "长而清晰，情感丰富但可能过于感性"},
                    {path: "M20,20 C25,18 40,16 60,22", desc: "较短但深刻，情感专注但可能缺乏表达"},
                    {path: "M20,20 C28,16 42,14 58,24", desc: "有分叉和岛纹，情感经历复杂"}
                ];
                
                const fateLineTypes = [
                    {path: "M45,50 L45,30", desc: "清晰笔直，事业发展顺利但可能缺乏变化"},
                    {path: "M45,55 L45,35", desc: "有中断，职业生涯可能有重大转变"},
                    {path: "M42,52 L48,30", desc: "弯曲不明显，命运受外界影响较大"}
                ];
                
                const lifeLine = lifeLineTypes[Math.floor(prng() * 3)];
                const mindLine = mindLineTypes[Math.floor(prng() * 3)];
                const heartLine = heartLineTypes[Math.floor(prng() * 3)];
                const fateLine = fateLineTypes[Math.floor(prng() * 3)];
                
                // 生成详细描述
                const lifeLineDesc = `你的生命线${lifeLine.desc}。${prng() > 0.5 ? '生命线起始清晰但中段出现断裂，表明早年体质强健，但中年时期可能面临健康挑战。' : '生命线整体连贯，显示一生健康状况相对稳定。'}生命线末端分叉${prng() > 0.5 ? '明显' : '不明显'}，提示晚年需注意${prng() > 0.5 ? '心血管健康' : '呼吸系统'}。`;
                
                const mindLineDesc = `你的智慧线${mindLine.desc}。${prng() > 0.5 ? '智慧线长而平直，显示逻辑思维能力强，但缺乏弯曲度表明创造性思维较弱。' : '智慧线弯曲明显，显示直觉和创造性思维较强。'}智慧线末端${prng() > 0.5 ? '有岛纹' : '清晰'}，提示${prng() > 0.5 ? '30岁前后可能经历决策困惑期' : '思维决策能力较强'}。`;
                
                const heartLineDesc = `你的感情线${heartLine.desc}。${prng() > 0.5 ? '感情线起始点高，显示情感丰富且早期恋爱经历较多。' : '感情线起始点较低，显示情感表达较为内敛。'}但线上有${prng() > 0.5 ? '交叉纹和断裂' : '轻微波动'}，提示情感关系中有不稳定因素，需注意沟通方式。`;
                
                const fateLineDesc = `你的命运线${fateLine.desc}。${prng() > 0.5 ? '命运线清晰显示事业发展有明确方向，但中途' : '命运线不明显表明'}${prng() > 0.5 ? '可能有重大转变' : '职业发展较为平稳'}。命运线与智慧线交汇处${prng() > 0.5 ? '有明显标记' : '清晰'}，提示${prng() > 0.5 ? '职业选择对人生轨迹影响重大' : '职业发展较为顺利'}。`;
                
                // 生成警告和优势
                const warnings = [
                    "需注意工作与生活的平衡，避免过度劳累导致健康问题。",
                    "情感表达方面需更加直接，避免误解积累导致关系紧张。",
                    "决策时需兼顾理性与直觉，避免因过于保守错失机会。",
                    "需加强时间管理能力，避免因拖延导致压力积累。",
                    "需注意财务规划，避免冲动消费影响长期稳定。",
                    "需关注消化系统健康，避免饮食不规律带来的问题。"
                ];
                
                const positives = [
                    "具有较强的适应能力，能在变化中找到新的机会。",
                    "情感细腻，能敏锐察觉他人需求，有利于人际关系。",
                    "逻辑思维清晰，适合从事需要分析能力的工作。",
                    "有较强的责任心，值得他人信赖。",
                    "直觉敏锐，有助于在关键时刻做出正确判断。",
                    "学习能力强，能够快速掌握新知识和技能。"
                ];
                
                const overallTendencies = [
                    "务实稳重", "直觉敏锐", "情感丰富", "理性分析", "创造力强", "适应力佳"
                ];
                
                const summaries = [
                    "在事业和健康方面有较好基础，但需注意情感表达和人际关系",
                    "情感丰富且直觉敏锐，但需加强理性决策和财务规划",
                    "逻辑思维清晰且适应力强，但需注意工作与生活的平衡",
                    "创造力强且学习能力佳，但需加强时间管理和执行力"
                ];
                
                return {
                    overallTendency: overallTendencies[Math.floor(prng() * overallTendencies.length)],
                    summary: summaries[Math.floor(prng() * summaries.length)],
                    lifeLine: {
                        path: lifeLine.path,
                        description: lifeLineDesc,
                        warning: warnings[Math.floor(prng() * warnings.length)],
                        positive: positives[Math.floor(prng() * positives.length)]
                    },
                    mindLine: {
                        path: mindLine.path,
                        description: mindLineDesc,
                        warning: warnings[Math.floor(prng() * warnings.length)],
                        positive: positives[Math.floor(prng() * positives.length)]
                    },
                    heartLine: {
                        path: heartLine.path,
                        description: heartLineDesc,
                        warning: warnings[Math.floor(prng() * warnings.length)],
                        positive: positives[Math.floor(prng() * positives.length)]
                    },
                    fateLine: {
                        path: fateLine.path,
                        description: fateLineDesc,
                        warning: warnings[Math.floor(prng() * warnings.length)],
                        positive: positives[Math.floor(prng() * positives.length)]
                    },
                    metrics: {
                        mind: 60 + Math.floor(prng() * 30),
                        emotion: 50 + Math.floor(prng() * 40),
                        career: 55 + Math.floor(prng() * 35),
                        health: 65 + Math.floor(prng() * 25),
                        relationship: 45 + Math.floor(prng() * 45)
                    },
                    radarData: {
                        labels: ["生命力", "智慧力", "情感力", "事业力", "健康力", "人际力"],
                        data: [
                            60 + Math.floor(prng() * 30),
                            50 + Math.floor(prng() * 40),
                            55 + Math.floor(prng() * 35),
                            65 + Math.floor(prng() * 25),
                            45 + Math.floor(prng() * 45),
                            50 + Math.floor(prng() * 40)
                        ]
                    },
                    details: {
                        overall: `根据掌型分析，您属于${prng() > 0.5 ? '土型掌' : '水型掌'}，${prng() > 0.5 ? '手掌厚实有肉' : '手掌修长纤细'}，显示${prng() > 0.5 ? '务实稳重' : '敏感细腻'}的性格特征。掌色${prng() > 0.5 ? '红润' : '偏白'}，显示${prng() > 0.5 ? '气血充足' : '需注意血液循环'}。`,
                        specialMarks: `掌中发现${prng() > 0.5 ? '神秘十字纹' : '三角形标记'}，位于${prng() > 0.5 ? '智慧线与感情线之间' : '生命线内侧'}，提示${prng() > 0.5 ? '有特殊直觉能力' : '在特定领域有独特天赋'}。此外，${prng() > 0.5 ? '火星平原较为发达' : '月丘有明显隆起'}，表明${prng() > 0.5 ? '抗压能力较强' : '想象力丰富'}。`,
                        future: `未来三年内，${prng() > 0.5 ? '事业宫有明显变化迹象' : '感情线末端出现新分支'}，提示${prng() > 0.5 ? '职业发展可能迎来重要转折' : '情感生活可能出现新机遇'}。${prng() > 0.5 ? '健康方面需注意消化系统' : '需关注肩颈健康'}，建议${prng() > 0.5 ? '保持规律作息' : '适当增加运动'}。`
                    }
                };
            }
            
            // 指标条动画
            function animateMetrics() {
                const metricFills = document.querySelectorAll('.metric-fill');
                metricFills.forEach(fill => {
                    const value = fill.getAttribute('data-value');
                    setTimeout(() => {
                        fill.style.width = value + '%';
                    }, 100);
                });
            }
            
            // 创建雷达图
            function createRadarChart(data) {
                const ctx = document.getElementById('palmRadarChart').getContext('2d');
                
                new Chart(ctx, {
                    type: 'radar',
                    data: {
                        labels: data.labels,
                        datasets: [{
                            label: '掌纹能量分布',
                            data: data.data,
                            backgroundColor: 'rgba(0, 198, 255, 0.2)',
                            borderColor: 'rgba(0, 198, 255, 0.8)',
                            pointBackgroundColor: 'rgba(0, 198, 255, 1)',
                            pointBorderColor: '#fff',
                            pointHoverBackgroundColor: '#fff',
                            pointHoverBorderColor: 'rgba(0, 198, 255, 1)'
                        }]
                    },
                    options: {
                        scales: {
                            r: {
                                angleLines: {
                                    color: 'rgba(255, 255, 255, 0.1)'
                                },
                                grid: {
                                    color: 'rgba(255, 255, 255, 0.1)'
                                },
                                pointLabels: {
                                    color: '#f0f0f0',
                                    font: {
                                        family: "'Noto Sans SC', sans-serif"
                                    }
                                },
                                ticks: {
                                    backdropColor: 'transparent',
                                    color: 'rgba(255, 255, 255, 0.5)',
                                    font: {
                                        family: "'Noto Sans SC', sans-serif"
                                    }
                                },
                                suggestedMin: 0,
                                suggestedMax: 100
                            }
                        },
                        plugins: {
                            legend: {
                                labels: {
                                    color: '#f0f0f0',
                                    font: {
                                        family: "'Noto Sans SC', sans-serif"
                                    }
                                }
                            }
                        }
                    }
                });
            }
        });
    </script>
</body>
</html>